package com.java.tutorials.jdk7.LinkedBlockingQueue;

import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.util.concurrent.LinkedBlockingQueue;
/**
 * Created by xuzhike on 2016/1/26.
 * http://www.java2s.com/Code/Java/JDK-7/UseLinkedBlockingQueue.htm
 * Use LinkedBlockingQueue
 */
public class UseLinkedBlockingQueue {
    public static void main(String[] args) throws Exception {
        LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<String>();
        FileOutputStream fos = new FileOutputStream("out.log");
        DataOutputStream dos = new DataOutputStream(fos);
        while (!queue.isEmpty()) {
            dos.writeUTF(queue.take());
        }
    }
}
